home *** CD-ROM | disk | FTP | other *** search
/ Especial Multimedia / Especial Multimedia.iso / Multimed / Herra / TIMWIN.ZIP / DHOLO.CMD < prev    next >
OS/2 REXX Batch file  |  1993-09-22  |  2KB  |  143 lines

  1. ;TIM-DEMO       HOLO    0.4.1
  2. ;holo    -  demonstratie min-max met hologrammenbeeld
  3. ;verwacht:  beginbeeld in a
  4. ;versie IT
  5. ;Modified for Windows version TIM
  6. ;****************************************************
  7. #include timdefs.h
  8.  
  9. parms
  10.   int imode
  11. endparms
  12. int tl, gval, olddraw, loop, err
  13. int bitplane, grijs
  14.  
  15. cls
  16. if (ver 1) == MK_CORTEX1
  17.   bitplane = 8
  18.   grijs = 255
  19. else
  20.   bitplane = red
  21.   grijs = 1
  22. endif
  23.  
  24.              ;prepare environment
  25. gval = set 1 1
  26. dest p
  27. show p
  28. copy a
  29.  
  30. ;     voer drempelingen uit met versch. dremp.waardes
  31.  
  32. *windispl h (imode+WINLUT1)
  33.  
  34.       ;only if image is FG image
  35. if ((improp) & DIS_BIT)  == DIS_BIT
  36.  zoom 1
  37.       ;show running threshold by loading LUTs
  38.  for tl = 20 to 255 step 3
  39.   thre a tl /
  40.   err = chk lut 2 5 4
  41.  endfor
  42.  
  43.  for tl = 250 to 25 step -3
  44.   thre a tl /
  45.   err = chk lut 2 5 4
  46.  endfor
  47.  
  48.  err = chk lut 2 3                 ;restore
  49.  zoom 0
  50. endif
  51.  
  52.              ;prepare LUTs
  53. era x 1 2 3
  54. err = chk lut 2 4       ;red = 1, green = 2, blue = 3
  55.  
  56. xorln p 80 0 80 255 1
  57. *windispl h (imode+WINLUT4+BITCOPY1)
  58.  
  59. dest q
  60. era q
  61. err = chk lut 2 4
  62.  
  63. line a 80
  64. grav 
  65. text 1 10 20 "line 80 from original image"
  66. copy q b          ;keep graph
  67. *windispl i (imode+NO_DITHER)    ;always image copy (no dither), use LUT 3
  68.  
  69. dest r
  70. err = chk lut 2 1             ;BW lut
  71. min a 15 
  72. max 15
  73. unif 11
  74. dest s
  75. max a 15
  76. min 15
  77. unif 11
  78. sub s r
  79. ;         local contrast stretch
  80. ;dest p
  81. dest r
  82. sub a r         ;trek ondergrens glad
  83.  
  84. div r s 222     ;trek bovengrens naar maximum
  85. era r 1 2 3
  86. xorln r 79 0 80 255 2    ;draw line 79 to keep 80 original
  87. *windispl h (imode+BITCOPY2)
  88.  
  89. err = chk lut 4
  90. dest q
  91. line r 80
  92. olddraw = set 4 2
  93. graf
  94. text 2 25 20 "line 80 from corrected image"
  95. or b q >b
  96.  
  97. *windispl i (imode+NO_DITHER)    ;always image copy (no dither), use LUT 4
  98.  
  99. dest p
  100. thre r
  101. keep 1
  102.  
  103. dest s
  104. label a 128     ;threshold original
  105. thre 2           ;get rid of large white object (upper-left)
  106. keep 2
  107. or p s          ;use this as a seed and
  108. lpr 2 1         ;propagate 
  109. band 1 2 3      ;keep pixels which are in both bitplanes
  110.  
  111.  
  112. bit 3
  113. keep 1 2
  114. *windispl i (imode+BITCOPY2)
  115. ;debug
  116. zoom 1
  117. lsk 2
  118. bcop 2 1
  119. lver 2
  120. ldi6 2 1
  121. ;debug
  122. binv 2
  123. band 1 2 3
  124. bcop 3 4
  125. lskz 3 4
  126. lps 3
  127. lpr 3 4
  128. bcop 3 2
  129. lenp 2
  130. ldi6 2 2
  131. lsk 2
  132. dest p
  133. show p
  134. and a 0xf8
  135. or p s
  136. bor 3 2 1
  137. era 2 3
  138. *windispl h (imode+BITCOPY1)
  139. set 1 gval
  140. set 4 olddraw
  141.  
  142. stop
  143.